﻿
namespace Leetcode.N1510;
public class Solution
{
    public bool WinnerSquareGame(int n)
    {
        var ans = new bool[n + 1];
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j * j <= i; j++)
            {
                if (!ans[i - j * j])
                {
                    ans[i] = true;
                    break;
                }
            }
        }
        return ans[n];
    }
}